Skip to content

smp-server: add serverInfoBytes to THandleParams and related functions#1825

Open
ed-asriyan wants to merge 1 commit into
simplex-chat:masterfrom
ed-asriyan:server-info
Open

smp-server: add serverInfoBytes to THandleParams and related functions#1825
ed-asriyan wants to merge 1 commit into
simplex-chat:masterfrom
ed-asriyan:server-info

Conversation

@ed-asriyan

Copy link
Copy Markdown

No description provided.

serviceAuth :: Bool
serviceAuth :: Bool,
-- | JSON-encoded ServerPublicInfo from handshake, present when server version >= serverInfoSMPVersion
serverInfoBytes :: Maybe ByteString

@epoberezkin epoberezkin Jul 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not include the actual type here, and parse JSON in parser? Or you think there is a value in lenient parser? but then you could just include Nothing if JSON fails to parse, or Either String ServerInfo (it would help to know in test that info was sent but was invalid).

Suggested change
serverInfoBytes :: Maybe ByteString
serverInfo :: Either String ServerPublicInfo

@ed-asriyan ed-asriyan Jul 16, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried replacing Maybe ByteString with Either String ServerPublicInfo, but putting it into the Transport.hs exports creates a cyclic dependency Simplex.Messaging.Transport -> Simplex.Messaging.Server.Information -> Simplex.Messaging.Agent.Protocol -> Simplex.Messaging.Transport.Client -> Simplex.Messaging.Transport.

I'm not export in Haskell - it's literally the first time for me writing on Haskell :) - but I guess untangling the dependencies may require more refactoring in other modules. Do you think it may worth it?

authPubKey :: Maybe CertChainPubKey
authPubKey :: Maybe CertChainPubKey,
-- | optional server public information (JSON-encoded ServerPublicInfo), sent when version >= serverInfoSMPVersion
serverInfo :: Maybe ByteString

@epoberezkin epoberezkin Jul 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
serverInfo :: Maybe ByteString
serverInfo :: Either String ServerPublicInfo

Comment thread src/Simplex/Messaging/Agent/Client.hs Outdated
Comment thread src/Simplex/Messaging/Agent/Client.hs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants